<template>
  <div class="box-item">
    <div
      v-if="item.goods_name"
      class="goods-item1"
      @click="$router.push(`/detail/${item.goods_id}`)"
    >
      <div class="left">
        <img :src="item.goods_image" alt="" />
      </div>
      <div class="right">
        <p class="text-ellipsis-2">
          {{ item.goods_name }}
        </p>
        <p class="price">
          <span class="new">¥{{ item.goods_price_min }}</span>
          <span class="old">¥{{ item.goods_price_max }}</span>
        </p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    item: {
      type: Object,
      default: () => {
        return {}
      }
    }
  }
}
</script>

<style lang="less" scoped>
.box-item {
  .goods-item1 {
    width: 180px;
    margin-bottom: 6px;
    background-color: #fff;

    .left {
      width: 180px;

      img {
        display: block;
        width: 100%;
      }
    }

    .right {
      padding-left: 15px;
      flex: 1;
      font-size: 14px;
      line-height: 1.3;
      display: flex;
      flex-direction: column;
      justify-content: space-evenly;

      .text-ellipsis-2 {
        width: 160px;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
      }

      .count {
        color: #999;
        font-size: 12px;
      }

      .price {
        color: #999;
        font-size: 16px;

        .new {
          color: #f03c3c;
          margin-right: 10px;
        }

        .old {
          text-decoration: line-through;
          font-size: 12px;
        }
      }
    }
  }
}
</style>
